package com.triones.api.controller.web;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.triones.api.entity.param.CryptoBillParams;
import com.triones.api.entity.vo.CryptoBillVO;
import com.triones.api.entity.vo.HelpVO;
import com.triones.api.service.CryptoBillService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 加密货币账单
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/cryptoBill")
public class CryptoBillController extends BaseController {

    private final CryptoBillService cryptoBillService;

    /**
     * 提币列表（分页）
     */
    @SaCheckPermission("system:cryptoExchange:pageList")
    @GetMapping("/pageList")
    public TableDataInfo<CryptoBillVO> pageList(CryptoBillParams cryptoBillParams, PageQuery pageQuery) {
        return cryptoBillService.pageList(cryptoBillParams, pageQuery,"transfer");
    }

    /**
     * 换汇列表（分页）
     */
    @SaCheckPermission("system:mixExchange:pageList")
    @GetMapping("/exchange/pageList")
    public TableDataInfo<CryptoBillVO> exchangePageList(CryptoBillParams cryptoBillParams, PageQuery pageQuery) {
        return cryptoBillService.pageList(cryptoBillParams, pageQuery,"exchange");
    }

    /**
     * 查询详细
     * @param id
     */
    @SaCheckPermission("system:cryptoExchange:query")
    @GetMapping(value = "/{id}")
    public R<CryptoBillVO> getInfo(@PathVariable Long id) {
        return R.ok(cryptoBillService.getInfo(id));
    }

    /**
     * 查询详细
     * @param id
     */
    @SaCheckPermission("system:mixExchange:query")
    @GetMapping(value = "/exchange/{id}")
    public R<CryptoBillVO> getExchangeInfo(@PathVariable Long id) {
        return R.ok(cryptoBillService.getInfo(id));
    }
}
